# 字符串格式化
name = "saddle bag"
price = 3000.9999
message = "{0:0^18} is {1:.3f} $";  # 填充字符串长度为18   保留小数点后3位
title = '''
hermes is world top brand 
you can buy it for me 
'''
# print(message.format(name, price), end='') # 定义结尾输出字符
# print(2**3) # 几次方
# # print("{1:.2f}".format(1/3)) # 几次方
# print(price)
# print(title)
# print((2 + 3)**3)
# print(3/7)
# print(4//2) #不能整除 为0

#buy_price = int(input('you have money ?'))  # 用户输入取整
buy_price = 20  # 用户输入取整
# if buy_price > 10 :
#     print('i can not buy it')
# else:
#     print('i want it ')

# while 循环
i = 0
while i < 2 :
  # print('have',i)
  i = i +1

for x in [3,5,8]: # php 里面也有range 生成数组
    if(x > 5): #   break # 断点
        continue # 跳出当前循环执行下一次
    # print(x)

def order_account(price = 3,count = 50):
    '''
        计算面积
    '''
    # return 'total price :',price*count


# print(order_account(1))
# order_account(count=200) # 可以跳过参数对应位置 直接指定关键字参数值


# 引入模块

# import brandModel
# print(brandModel.__path__)
# print(dir(brandModel))

# 数据结构

# - 列表
brand_indexs = ['dior', 'lv' , 'chanel', 'hermes', 'gucci']
# # print(brand_indexs.find('dior')!=-1) #找到字符串
# # print(len(brand_indexs))#
# brand_indexs.sort()
# print(brand_indexs)#
# print('&'.join(brand_indexs))

# - 元组
brand_indexs = ('dior', 'lv' , 'chanel', 'hermes', 'gucci')
new_brand = 'chloe','fendi',brand_indexs
# print(new_brand)
# print(new_brand[2][1])

# - 字典

brands = {'dior':'30000','hermes':'5000'}

for brand,price in brands.items():
    pass
# print('{0} price is {1}'.format(brand,price))

# - 序列

first_brands = ('dior', 'lv' , 'chanel', 'hermes', 'gucci')
# print(first_brands[1:3]) # 1开始 3结束
# print(first_brands[::2]) #  0 2 4 位置元素


# 备份

import os
import time
# print(os.path.exists('./vintage/')) # 判断路径存在
# print(time.strftime('%H%M%S')) #时间格式化

class Vintage: # 类
    count = 1

    '''初始化数据'''
    def __init__(self,name):
        self.name = name
        self.count += 1
    def fromWhere(self):
        return self.name+'Japan'

    def fromSku(self):
        self.count += 5
        return  '成色好，自用送人都可以'
vintageModel = Vintage('Ohanel')
# print(vintageModel)
# print(vintageModel.fromWhere())
# print(vintageModel.fromSku())
# print(vintageModel.count)


class Dior(Vintage): # 继承
    def __init__(self,name):
        Vintage.__init__(self,name)


class Hermes(Vintage):
    def __init__(self,name):
        Vintage.__init__(self,name)

DiorModel = Dior('戴妃')
HermesModel = Hermes('laddy')

print(DiorModel.name[::-1])
print(HermesModel.name)

try: # 捕捉异常
 text = input('Enter?something?-->?')
except EOFError:
    print('Why?did?you?do?an?EOF?on?me?')
except KeyboardInterrupt:
    print('You?cancelled?the?operation.')
else:
    print('You?entered?{}'.format(text))










